*Do File for Helping to Break Glass Ceiling*

*Data
use "HelpingBreakPolBehData.dta", clear

*Contextual Information
gsort State, gen(Code)
tab Code

***Independent Variables*************
*gender recode
gen gender2=gender
recode gender2 2=0
tab gender2
tab gender

*age
gen age=(2016-birthyr)
tab age

*education 0-1
gen education=educ
tab education educ

*white
gen white = race
recode white (1=1) (2/8=0)
tab white
tab race

*marriage
gen married = marstat
recode married (1=1) (2/6=0)
tab married
tab marstat

*income
gen income = faminc
recode income (97/99=.)
recode income 31=12
tab income
tab faminc

*partyid (0 to 7 with 7 = Republican)
recode pid7 (8=4), gen(partyid7) 
tab partyid7 
tab pid7

* ideology (0-5 with Conservative at 5)
recode ideo5 (6=.), gen(newideology)
tab newideology
tab ideo5

*sisters
gen sister = UMA312b_1
recode sister (0=0) (1/max=1)  
tab sister
tab UMA312b_1

*children
gen children = UMA313
recode children (0=0) (1/50=1)
tab children UMA313
tab UMA313
tab children

*father
gen father = .
replace father = 1 if (gender==1 & children==1)
replace father = 0 if (gender==1 & children==0)
tab father
tab gender children

* mother
gen mother = .
replace mother = 1 if (gender==2 & children==1)
replace mother = 0 if (gender==2 & children==0)
tab mother
tab gender children

*parent
gen parent = .
replace parent = 1 if (father==1)
replace parent = 1 if (mother==1)
replace parent = 0 if (father==0)
replace parent = 0 if (mother==0)
tab parent 

*daughter (binary)
gen daughter = . 
replace daughter = 1 if (Child1B==4)
replace daughter = 1 if (Child2B==4)
replace daughter = 1 if (Child3B==4)
replace daughter = 1 if (Child4B==4)
replace daughter = 1 if (Child5B==4)
replace daughter = 0 if (daughter~=1) 
tab daughter
tab Child1B
tab Child2B
tab Child3B
tab Child4B
tab Child5B

*son (binary)
gen son = . 
replace son = 1 if (Child1B==3)
replace son = 1 if (Child2B==3)
replace son = 1 if (Child3B==3)
replace son = 1 if (Child4B==3)
replace son = 1 if (Child5B==3)
replace son = 0 if (son~=1) 
tab son
tab Child1B
tab Child2B
tab Child3B
tab Child4B
tab Child5B

*One Respondent indicates that they have a daughter, but not a parent of a child
drop if parent==0 & daughter==1

*get rid if number of children is greater than 5 (about 2.25% of respondents)
drop if UMA313 > 5


*number of daughters
gen numberdaughtersX = .
*all combinations of 1 daughter
replace numberdaughtersX = 1 if (UMA313==1 & Child1B==4)

replace numberdaughtersX = 1 if (UMA313==2 & Child1B==3 & Child2B==4)
replace numberdaughtersX = 1 if (UMA313==2 & Child1B==4 & Child2B==3)

replace numberdaughtersX = 1 if (UMA313==3 & Child1B==4 & Child2B==3 & Child3B==3)
replace numberdaughtersX = 1 if (UMA313==3 & Child1B==3 & Child2B==4 & Child3B==3)
replace numberdaughtersX = 1 if (UMA313==3 & Child1B==3 & Child2B==3 & Child3B==4)

replace numberdaughtersX = 1 if (UMA313==4 & Child1B==4 & Child2B==3 & Child3B==3 & Child4B==3)
replace numberdaughtersX = 1 if (UMA313==4 & Child1B==3 & Child2B==4 & Child3B==3 & Child4B==3)
replace numberdaughtersX = 1 if (UMA313==4 & Child1B==3 & Child2B==3 & Child3B==4 & Child4B==3)
replace numberdaughtersX = 1 if (UMA313==4 & Child1B==3 & Child2B==3 & Child3B==3 & Child4B==4)

replace numberdaughtersX = 1 if (UMA313==5 & Child1B==4 & Child2B==3 & Child3B==3 & Child4B==3 & Child5B==3)
replace numberdaughtersX = 1 if (UMA313==5 & Child1B==3 & Child2B==4 & Child3B==3 & Child4B==3 & Child5B==3)
replace numberdaughtersX = 1 if (UMA313==5 & Child1B==3 & Child2B==3 & Child3B==4 & Child4B==3 & Child5B==3)
replace numberdaughtersX = 1 if (UMA313==5 & Child1B==3 & Child2B==3 & Child3B==3 & Child4B==4 & Child5B==3)
replace numberdaughtersX = 1 if (UMA313==5 & Child1B==3 & Child2B==3 & Child3B==3 & Child4B==3 & Child5B==4)

*all combinations of 2 daughters
replace numberdaughtersX = 2 if (UMA313==2 & Child1B==4 & Child2B==4)

replace numberdaughtersX = 2 if (UMA313==3 & Child1B==4 & Child2B==4 & Child3B==3)
replace numberdaughtersX = 2 if (UMA313==3 & Child1B==4 & Child2B==3 & Child3B==4)
replace numberdaughtersX = 2 if (UMA313==3 & Child1B==3 & Child2B==4 & Child3B==4)

replace numberdaughtersX = 2 if (UMA313==4 & Child1B==4 & Child2B==4 & Child3B==3 & Child4B==3)
replace numberdaughtersX = 2 if (UMA313==4 & Child1B==4 & Child2B==3 & Child3B==4 & Child4B==3)
replace numberdaughtersX = 2 if (UMA313==4 & Child1B==4 & Child2B==3 & Child3B==3 & Child4B==4)
replace numberdaughtersX = 2 if (UMA313==4 & Child1B==3 & Child2B==4 & Child3B==4 & Child4B==3)
replace numberdaughtersX = 2 if (UMA313==4 & Child1B==3 & Child2B==4 & Child3B==3 & Child4B==4)
replace numberdaughtersX = 2 if (UMA313==4 & Child1B==3 & Child2B==3 & Child3B==4 & Child4B==4)

replace numberdaughtersX = 2 if (UMA313==5 & Child1B==4 & Child2B==4 & Child3B==3 & Child4B==3 & Child5B==3)
replace numberdaughtersX = 2 if (UMA313==5 & Child1B==4 & Child2B==3 & Child3B==4 & Child4B==3 & Child5B==3)
replace numberdaughtersX = 2 if (UMA313==5 & Child1B==4 & Child2B==3 & Child3B==3 & Child4B==4 & Child5B==3)
replace numberdaughtersX = 2 if (UMA313==5 & Child1B==4 & Child2B==3 & Child3B==3 & Child4B==3 & Child5B==4)
replace numberdaughtersX = 2 if (UMA313==5 & Child1B==3 & Child2B==4 & Child3B==4 & Child4B==3 & Child5B==3)
replace numberdaughtersX = 2 if (UMA313==5 & Child1B==3 & Child2B==4 & Child3B==3 & Child4B==4 & Child5B==3)
replace numberdaughtersX = 2 if (UMA313==5 & Child1B==3 & Child2B==4 & Child3B==3 & Child4B==3 & Child5B==4)
replace numberdaughtersX = 2 if (UMA313==5 & Child1B==3 & Child2B==3 & Child3B==4 & Child4B==4 & Child5B==3)
replace numberdaughtersX = 2 if (UMA313==5 & Child1B==3 & Child2B==3 & Child3B==4 & Child4B==3 & Child5B==4)
replace numberdaughtersX = 2 if (UMA313==5 & Child1B==3 & Child2B==3 & Child3B==3 & Child4B==4 & Child5B==4)

*all combinations of 3 daughters
replace numberdaughtersX = 3 if (UMA313==3 & Child1B==4 & Child2B==4 & Child3B==4)

replace numberdaughtersX = 3 if (UMA313==4 & Child1B==4 & Child2B==4 & Child3B==4 & Child4B==3)
replace numberdaughtersX = 3 if (UMA313==4 & Child1B==4 & Child2B==4 & Child3B==3 & Child4B==4)
replace numberdaughtersX = 3 if (UMA313==4 & Child1B==4 & Child2B==3 & Child3B==4 & Child4B==4)
replace numberdaughtersX = 3 if (UMA313==4 & Child1B==3 & Child2B==4 & Child3B==4 & Child4B==4)


replace numberdaughtersX = 3 if (UMA313==5 & Child1B==4 & Child2B==4 & Child3B==4 & Child4B==3 & Child5B==3)
replace numberdaughtersX = 3 if (UMA313==5 & Child1B==4 & Child2B==4 & Child3B==3 & Child4B==4 & Child5B==3)
replace numberdaughtersX = 3 if (UMA313==5 & Child1B==4 & Child2B==4 & Child3B==3 & Child4B==3 & Child5B==4)
replace numberdaughtersX = 3 if (UMA313==5 & Child1B==4 & Child2B==4 & Child3B==3 & Child4B==3 & Child5B==4)
replace numberdaughtersX = 3 if (UMA313==5 & Child1B==3 & Child2B==4 & Child3B==4 & Child4B==4 & Child5B==3)
replace numberdaughtersX = 3 if (UMA313==5 & Child1B==3 & Child2B==4 & Child3B==4 & Child4B==3 & Child5B==4)
replace numberdaughtersX = 3 if (UMA313==5 & Child1B==3 & Child2B==3 & Child3B==4 & Child4B==4 & Child5B==4)
replace numberdaughtersX = 3 if (UMA313==5 & Child1B==3 & Child2B==4 & Child3B==3 & Child4B==4 & Child5B==4)
replace numberdaughtersX = 3 if (UMA313==5 & Child1B==3 & Child2B==4 & Child3B==4 & Child4B==3 & Child5B==4)

*all combinations of 4 daughters
replace numberdaughtersX = 4 if (UMA313==4 & Child1B==4 & Child2B==4 & Child3B==4 & Child4B==4)

replace numberdaughtersX = 4 if (UMA313==5 & Child1B==4 & Child2B==4 & Child3B==4 & Child4B==4 & Child5B==3)
replace numberdaughtersX = 4 if (UMA313==5 & Child1B==4 & Child2B==4 & Child3B==4 & Child4B==3 & Child5B==4)
replace numberdaughtersX = 4 if (UMA313==5 & Child1B==4 & Child2B==4 & Child3B==3 & Child4B==4 & Child5B==4)
replace numberdaughtersX = 4 if (UMA313==5 & Child1B==4 & Child2B==3 & Child3B==4 & Child4B==4 & Child5B==4)
replace numberdaughtersX = 4 if (UMA313==5 & Child1B==3 & Child2B==4 & Child3B==4 & Child4B==4 & Child5B==4)

*all combinations of 5 daughters
replace numberdaughtersX = 5 if (UMA313==5 & Child1B==4 & Child2B==4 & Child3B==4 & Child4B==4 & Child5B==4)

replace numberdaughtersX = 0 if (Child1B~=4 & Child2B~=4 & Child3B~=4 & Child4B~=4 & Child5B~=4)

gen numberdaughters3 = numberdaughtersX/5
tab numberdaughters3

*fathers with daughters (0 is fathers without daughters)
gen fatherdaughter = .
replace fatherdaughter = 1 if (father==1 & daughter==1)
replace fatherdaughter = 0 if (father==1 & daughter~=1)
tab fatherdaughter
tab father daughter

*fathers with first daughter (0 are fathers without first daughter)
gen fatherfirstdaughter = .
replace fatherfirstdaughter = 1 if (father==1 & Child1B==4)
replace fatherfirstdaughter = 0 if (father==1 & Child1B~=4)
tab father Child1B
tab fatherfirstdaughter

*firstdaughter
gen firstdaughter=. 
replace firstdaughter = 1 if (parent==1 & Child1B==4)
replace firstdaughter = 0 if (parent==1 & Child1B~=4)

*parentdaughter
gen parentdaughter=. 
replace parentdaughter = 1 if (parent==1 & daughter==1)
replace parentdaughter = 0 if (parent==1 & daughter~=1)
tab parentdaughter

*proportion of children that are daughters
gen numberchildren=UMA313
gen proportiondaughters=numberdaughtersX/numberchildren
tab proportiondaughters


*came of age (18 years old) after Title IX
gen age2=2016-birthyr
gen titleIXadult=age2
tab titleIXadult
recode titleIXadult 0/62=1 63/93=0
tab titleIXadult

*had child after Title IX
gen titleIXchild=Child1A 
recode titleIXchild 1947/1971=0 1972/max=1
tab titleIXchild

*differentiating young from older fathers
gen ageBecamefather=Child1A-birthyr
recode ageBecamefather -9/14=.
tab ageBecamefather  

*Age Became Father2
gen agebecamefather2 = ageBecamefather/54
tab agebecamefather2

*Young Father (Impressionable Years vs. Older)
gen youngFather=ageBecamefather
recode youngFather 15/25=1 26/max=0
tab youngFather

*Age of First Child
gen ageoffirstchild=(2016-Child1A)
tab ageoffirstchild

*Age of First Daughter
gen ageoffirstdaughter = ageoffirstchild if Child1B==4
tab ageoffirstdaughter

*Racial Resentment
gen irishracialresent = UMA301_1
recode irishracialresent (1=5) (2=4) (3=3) (4=2) (5=1) (6=3)
tab UMA301_1
tab irishracialresent

gen generationracialresent = UMA301_2
recode generationracialresent (1=1) (2=2) (3=3) (4=4) (5=5) (6=3)
tab UMA301_2
tab generationracialresent

gen deserveracialresent = UMA301_3
recode deserveracialresent (1=1) (2=2) (3=3) (4=4) (5=5) (6=3)
tab UMA301_3
tab deserveracialresent

gen tryhardracialresent = UMA301_4
recode tryhardracialresent (1=5) (2=4) (3=3) (4=2) (5=1) (6=3)
tab UMA301_4
tab tryhardracialresent

*Racial Resentment Index (1=Opposed to Racial Resentment)
alpha irishracialresent generationracialresent deserveracialresent tryhardracialresent, gen(racialresent2)

*Hostile Sexism Scale (20= Support for Hostile Sexism)
gen hostile1=UMA306a
gen hostile2=UMA306b
gen hostile3=UMA306c
gen hostile4=UMA306d

alpha hostile1 hostile2 hostile3 hostile4, gen(hostilesexismscale2)
tab hostilesexismscale2

*importance of religion
gen religimp=pew_religimp
recode religimp 1=4 2=3 3=2 4=1
tab religimp

*Working
recode employ (1/2=1) (3/9=0), gen (working)
tab working
tab employ

*economy worse
recode CC16_302 (6=3), gen(econworse)
tab econworse

*likely vote
gen likelyvote2016=CC16_364
recode likelyvote2016 3=1 2=0 4/5=0

*Democrat PartyID
gen democrat=pid7
recode democrat 1/3=1 4/7=0


******Dependent Variables*********

*Vote
recode CC16_401 (5=1) (1/4=0) (8/9=.), gen (vote2016)
tab vote2016
tab CC16_401

*VoteHillaryinGeneral
recode CC16_410a (1=0) (3/8=0) (2=1), gen (voteclinton2016)
tab voteclinton2016
tab CC16_410a

*Prefer Clinton Pre-Election
gen prefclinton2016NEW=CC16_364c
recode prefclinton2016NEW 1=0 2=1 3=0 4=. 5=0 6/7=. 

* Vote Obama
recode CC16_326 (1=1) (2/9=0), gen (voteobama2012)
tab voteobama2012
tab CC16_326    

 
***Table 1****
logit prefclinton2016NEW white age income education married partyid7 newideology religimp working sister hostilesexismscale2  econworse racialresent2 firstdaughter if father==1 & likelyvote2016==1 & tookpost==1 [pw=weight], cluster (Code)
margins, over (firstdaughter) atmeans

**Table 2***
logit voteclinton2016 white age income education married partyid7 newideology religimp working sister hostilesexismscale2 econworse racialresent2 firstdaughter   if father==1 & tookpost==1 & vote2016==1 & CC16_410a ~=4 [pw=weight], cluster (Code) 
margins, over (partyid7) atmeans
margins, over (newideology) atmeans
margins, over (firstdaughter) atmeans

***Table 3****
logit voteobama2012 white age income education married partyid7 newideology religimp working sister hostilesexismscale2  econworse racialresent2 firstdaughter if father==1 & tookpost==1 & vote2016==1 & CC16_410a ~=4  [pw=weight], cluster (Code) 

***Table 4***
set level 84
logit prefclinton2016NEW white age income education married c.partyid7 newideology religimp working sister hostilesexismscale2  econworse racialresent2 i.firstdaughter i.firstdaughter##c.partyid7 if father==1 & likelyvote2016==1 & tookpost==1 [pw=weight], cluster (Code)
logit voteclinton2016 white age income education married c.partyid7 newideology religimp working sister hostilesexismscale2 econworse racialresent2 i.firstdaughter i.firstdaughter##c.partyid7  if father==1 & tookpost==1 & vote2016==1 & CC16_410a ~=4 [pw=weight], cluster (Code) 

***Table 5 ***
logit prefclinton2016NEW white age i.gender2 income education married partyid7 newideology religimp working sister hostilesexismscale2  econworse racialresent2 i.firstdaughter i.gender2##i.firstdaughter if parent==1 & likelyvote2016==1 & tookpost==1 [pw=weight], cluster (Code)
logit voteclinton2016 white age i.gender2 income education married partyid7 newideology religimp working sister hostilesexismscale2  econworse racialresent2 i.firstdaughter i.gender2##i.firstdaughter if parent==1 & likelyvote2016==1 & tookpost==1 [pw=weight], cluster (Code)

**Figure 1***
margins gender2, at(firstdaughter=(0(1)1)) vsquish
logit voteclinton2016 white age i.gender2 income education married partyid7 newideology religimp working sister hostilesexismscale2 econworse racialresent2 i.firstdaughter i.gender2##i.firstdaughter if parent==1 & tookpost==1 & vote2016==1 & CC16_410a ~=4 [pw=weight], cluster (Code) 
**Figure 1***
margins gender2, at(firstdaughter=(0(1)1)) vsquish
 
***************Survey Experiment****************UPDATED 7-6-18******************

*partyid (0 to 1 with 1 = Republican)
gen tpartyid7 = pid7
recode tpartyid7 (1=0) (2=.16) (3=.32) (4=.48) (5=.64) (6=.80) (7=1) (8=.48)
tab tpartyid7 
tab pid7

gen control = UMA323rand
recode control (1=1) (2/3=0)
tab UMA323rand
tab control

gen btreatment = UMA323rand
recode btreatment (2=1) (3=0) (1=0)
tab UMA323rand
tab btreatment

gen ctreatment = UMA323rand
recode ctreatment (1/2=0) (3=1) 
tab UMA323rand
tab ctreatment

gen votemolly = UMA323/100
tab votemolly

gen attentioncheck = UMA324
recode attentioncheck (1/3=0) (4=1)
tab attentioncheck
tab UMA324

gen mollyideology = UMA325
recode mollyideology (1=0) (2=.16) (3=.32) (4=.48) (5=.64) (6=.80) (7=1)
tab mollyideology
tab UMA325

***Table 6*** - Only Fathers
regress votemolly mollyideology attention tpartyid7 i.btreatment i.ctreatment i.firstdaughter if father==1 & tookpost==1 & vote2016==1 & CC16_410a ~=4 [pw=weight], cluster (Code) 
regress votemolly mollyideology attention tpartyid7 i.btreatment i.ctreatment i.firstdaughter i.firstdaughter##i.btreatment i.firstdaughter##i.ctreatment if father==1 & tookpost==1 & vote2016==1 & CC16_410a ~=4 [pw=weight], cluster (Code) 

**Figure 2***
margins firstdaughter, at(btreatment=(0(1)1)) vsquish
margins firstdaughter, at(ctreatment=(0(1)1)) vsquish

***Table 7**** - Partisanship
regress votemolly mollyideology attention tpartyid7 i.btreatment i.ctreatment i.firstdaughter i.firstdaughter##i.btreatment i.firstdaughter##i.ctreatment if father==1 & tookpost==1 & vote2016==1 & CC16_410a ~=4 & tpartyid7 > .49 [pw=weight], cluster (Code) 
regress votemolly mollyideology attention tpartyid7 i.btreatment i.ctreatment i.firstdaughter i.firstdaughter##i.btreatment i.firstdaughter##i.ctreatment if father==1 & tookpost==1 & vote2016==1 & CC16_410a ~=4 & tpartyid7 < .47 [pw=weight], cluster (Code) 

**Figure 3***
margins firstdaughter, at(ctreatment=(0(1)1)) vsquish
marginsplot, recast(line) recastci(rarea)



